from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC

class TrackingPage:
    def __init__(self, driver):
        self.driver = driver
        self.tracking_number_input_locator = (By.ID, "tracking-number")
        self.track_button_locator = (By.ID, "track-button")
        self.status_message_locator = (By.ID, "status-message")
        self.error_message_locator = (By.ID, "error-message")

    def navigate(self):
        self.driver.get('http://example.com/track')

    def enter_tracking_number(self, tracking_number):
        tracking_number_input = WebDriverWait(self.driver, 10).until(
            EC.presence_of_element_located(self.tracking_number_input_locator)
        )
        tracking_number_input.clear()
        tracking_number_input.send_keys(tracking_number)

    def click_track_button(self):
        track_button = WebDriverWait(self.driver, 10).until(
            EC.element_to_be_clickable(self.track_button_locator)
        )
        track_button.click()

    def get_status_message(self):
        status_message = WebDriverWait(self.driver, 10).until(
            EC.presence_of_element_located(self.status_message_locator)
        )
        return status_message.text

    def get_error_message(self):
        error_message = WebDriverWait(self.driver, 10).until(
            EC.presence_of_element_located(self.error_message_locator)
        )
        return error_message.text